package com.cskaoyan.shopping.controller;

import com.cskaoyan.mall.commons.result.ResponseData;
import com.cskaoyan.mall.commons.result.ResponseUtil;
import com.cskaoyan.mall.dto.ProductDetailDto;
import com.cskaoyan.shopping.service.IProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 小焦
 * @since 2022/10/25 20:07
 */

@RestController
public class IProductController {

    @Autowired
    IProductService productService;

    @GetMapping("/shopping/product/{id}")
    public ResponseData getProductDetail(@PathVariable("id") Long id){
        ProductDetailDto productDetail = productService.getProductDetail(id);
        return new ResponseUtil().setData(productDetail);
    }
}
